// 用户信息管理模块
import { userAccountLogin } from '@/api/user'
const user = {
  namespaced: true,
  state: () => ({
    profile: {}
  }),
  mutations: {
    setUserInfo (state, userInfo) {
      state.profile = userInfo
    },
    clearUserInfo (state) {
      state.profile = {}
    }
  },
  actions: {
    async asyncLogin (ctx, { account, password }) {
      const res = await userAccountLogin({ account, password })
      ctx.commit('setUserInfo', res.result)
    }
  },
  getters: { }
}

export default user
